/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores;

import Entidades.Area;
import Entidades.Cargo;
import Entidades.Operario;
import Entidades.Operariorol;
import Entidades.Rol;
import java.util.Collection;
import java.util.List;
import logica.jpaControllers.OperariorolJpaController;

/**
 *
 * @author USER
 */
public class CtrlOperariorol {

    /** Creates a new instance of CtrlABMArticulos */
    public CtrlOperariorol() {
    }
    //guarda articulo

    public void guardarOperariorol(Operariorol op) {
        OperariorolJpaController ga = new OperariorolJpaController();
        ga.create(op);
    }

    public void eliminarOperariorol(Operariorol op) throws Exception {
        OperariorolJpaController ga = new OperariorolJpaController();
        ga.destroy(op.getIdoperariorol());
    }

    public void modificarOperariorol(Operariorol op) throws Exception {
        OperariorolJpaController ga = new OperariorolJpaController();
        ga.edit(op);
    }

    public Operariorol buscarOperariorol_X_idOperariorol(int idoperario) {
        OperariorolJpaController ga = new OperariorolJpaController();
        return ga.findOperariorol(idoperario);

    }

public Collection<Operariorol> buscarOperariorol_X_idOperario(Integer idoperario) {
        OperariorolJpaController ga = new OperariorolJpaController();
        return  (Collection<Operariorol>) ga.findByIdoperario(idoperario);

    }

    public List buscarTodosOperariorol() throws Exception {
        OperariorolJpaController ga = new OperariorolJpaController();
        return ga.findOperariorolEntities();
    }

 public boolean BuscarACR(Area area, Cargo cargo, Rol rol, Operario operario) {
        OperariorolJpaController ga = new OperariorolJpaController();
        return ga.findACR(area, cargo, rol, operario);
    }
public boolean BuscarAR(Area area,  Rol rol, Operario operario) {
        OperariorolJpaController ga = new OperariorolJpaController();
        return ga.findAR(area, rol, operario);
    }
}
